package B3;


import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;

    public class Str {
        private String str ="";
        public String print() {
            if(this.str.length() >= 0){
                this.str=readSource();
                String s=this.str.replaceAll("\\\\\"","\"");
                return s.substring(1,s.length()-1);
            }else{
                return "source.txt is empty";
            }
        }
        private String readSource() {
            try {
                String s="";
                InputStreamReader isr = new InputStreamReader(new FileInputStream("D:\\java\\test3\\src\\B3\\source"), "UTF-8");
                BufferedReader br = new BufferedReader(isr);
                String line = null;
                while ((line = br.readLine())!= null) {
                    s += line;
                }
                br.close();
                isr.close();
                return s;
            } catch (IOException e) {
                e.printStackTrace();
                return null;
            }
        }
    }

